revisions of an article.
$title: Title object of the article
$ids: Ids to set the visibility for
+$visibilityChangeMap: Map of revision id to oldBits and newBits. This array can be
+ examined to determine exactly what visibility bits have changed for each
+ revision. This array is of the form
+ [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ]
'ArticleRollbackComplete': After an article rollback is completed.
$wikiPage: the WikiPage that was edited
$virtualNewBits = 0;
$logType = 'delete';
+ // Will be filled with id => [old, new bits] information and
+ // passed to doPostCommitUpdates().
+ $visibilityChangeMap = [];
+
// @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $this->reset(); $this->current(); $this->next() ) {
// @codingStandardsIgnoreEnd
} elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
$authorIPs[] = $item->getAuthorName();
}
+
+ // Save the old and new bits in $visibilityChangeMap for
+ // later use.
+ $visibilityChangeMap[$item->getId()] = [
+ 'oldBits' => $oldBits,
+ 'newBits' => $newBits,
+ ];
} else {
$itemStatus->error(
'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
// Clear caches
$that = $this;
- $dbw->onTransactionIdle( function() use ( $that ) {
- $that->doPostCommitUpdates();
+ $dbw->onTransactionIdle( function() use ( $that, $visibilityChangeMap ) {
+ $that->doPostCommitUpdates( $visibilityChangeMap );
} );
$dbw->endAtomic( __METHOD__ );
/**
* A hook for setVisibility(): do any necessary updates post-commit.
* STUB
+ * @param array [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ]
* @return Status
*/
- public function doPostCommitUpdates() {
+ public function doPostCommitUpdates( array $visibilityChangeMap ) {
return Status::newGood();
}
return Status::newGood();
}
- public function doPostCommitUpdates() {
+ public function doPostCommitUpdates( array $visibilityChangeMap ) {
$this->title->purgeSquid();
// Extensions that require referencing previous revisions may need this
- Hooks::run( 'ArticleRevisionVisibilitySet', [ $this->title, $this->ids ] );
+ Hooks::run( 'ArticleRevisionVisibilitySet', [ $this->title, $this->ids, $visibilityChangeMap ] );
return Status::newGood();
}
}